//测试-图
//编译：g++ TestGraph.cpp ../../*/*/Graph.hpp -o test
#ifndef __TESTGRAPH__CPP
#define __TESTGRAPH__CPP

#include<iostream>
#include"../../DataStructure/Graph/Graph.hpp"

using namespace std;
using namespace NgSiuKei;

int main(void) {
    srand(time(0));
    Graph<int, int> graph;
    for(int i=0; i<MAX_SIZE; ++i) {
        cout << "插入值：" << i << endl;
        graph.insertVal(i);
        graph.print();
    }

    for(int i=0; i<MAX_SIZE-1; ++i) {
        for(int j=i+1; j<MAX_SIZE; ++j) {
            int num = rand()%100+1;
            cout << "创建无向有权路：" << i << "->" << j << " = " << num << endl;
            graph.setEdge(i, j, num, GraphRoadTypeUndirected);
            graph.print();
        } 
    }

    cout << "图类型：" << graph.getType() << endl;//应该是1
    cout << "------------------------------------" << endl;

    for(int i=0; i<MAX_SIZE-1; ++i) {
        for(int j=i+1; j<MAX_SIZE; ++j) {
            cout << "删除无向有权路：" << i << "->" << j << endl;
            graph.deleteEdge(i, j, GraphRoadTypeUndirected);
            graph.print();
        } 
    }

    for(int i=0; i<MAX_SIZE-1; ++i) {
        for(int j=i+1; j<MAX_SIZE; ++j) {
            int num1 = rand()%100+1;
            int num2 = rand()%100+1;
            cout << "创建有向有权路：[ " << i << "->" << j << " = " << num1 << " ] [ " << j << "->" << i << " = " << num2 << " ]" << endl;
            graph.setEdge(i, j, num1, GraphRoadTypeDirected);
            graph.setEdge(j, i, num2, GraphRoadTypeDirected);
            graph.print();
        }
    }

    cout << "图类型：" << graph.getType() << endl;//应该是11
    cout << "------------------------------------" << endl;

    int num = rand()%MAX_SIZE;
    cout << "删除值：" << num << endl;
    graph.deleteVal(num);
    graph.print();

    num = rand()%MAX_SIZE;
    cout << "删除值：" << num << endl;
    graph.deleteVal(num);
    graph.print();

    return 0;
}

#endif